package com.sdhs.costcontrol.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sdhs.common.annotation.Log;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.enums.BusinessType;
import com.sdhs.costcontrol.domain.ControlContract;
import com.sdhs.costcontrol.domain.GcControlContractPay;
import com.sdhs.costcontrol.service.IGcControlContractPayService;

/**
 * 合同支付跟踪Controller
 * 
 * @author wanglei
 * @date 2025-03-14
 */
@RestController
@RequestMapping("/costcontrol/contractPayment")
public class GcControlContractPayController extends BaseController
{
    @Autowired
    private IGcControlContractPayService gcControlContractPayService;

    /**
     * 查询合同支付跟踪列表
     */
    @PreAuthorize("@ss.hasPermi('costcontrol:contractPayment:list')")
    @GetMapping("/list")
    public AjaxResult list(GcControlContractPay gcControlContractPay)
    {
    	ControlContract controlContract = gcControlContractPayService.selectGcControlContractPayList(gcControlContractPay);
    	return success(controlContract);
    }

    /**
     * 导出合同支付跟踪列表
     */
//    @PreAuthorize("@ss.hasPermi('costcontrol:contractPayment:export')")
//    @Log(title = "合同支付跟踪", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, GcControlContractPay gcControlContractPay)
//    {
//        List<GcControlContractPay> list = gcControlContractPayService.selectGcControlContractPayList(gcControlContractPay);
//        ExcelUtil<GcControlContractPay> util = new ExcelUtil<GcControlContractPay>(GcControlContractPay.class);
//        util.exportExcel(response, list, "合同支付跟踪数据");
//    }

    /**
     * 获取合同支付跟踪详细信息
     */
    @PreAuthorize("@ss.hasPermi('costcontrol:contractPayment:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(gcControlContractPayService.selectGcControlContractPayById(id));
    }

    /**
     * 新增合同支付跟踪
     */
    @PreAuthorize("@ss.hasPermi('costcontrol:contractPayment:add')")
    @Log(title = "合同支付跟踪", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GcControlContractPay gcControlContractPay)
    {
        return toAjax(gcControlContractPayService.insertGcControlContractPay(gcControlContractPay));
    }

    /**
     * 修改合同支付跟踪
     */
    @PreAuthorize("@ss.hasPermi('costcontrol:contractPayment:edit')")
    @Log(title = "合同支付跟踪", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GcControlContractPay gcControlContractPay)
    {
        return toAjax(gcControlContractPayService.updateGcControlContractPay(gcControlContractPay));
    }

    /**
     * 删除合同支付跟踪
     */
    @PreAuthorize("@ss.hasPermi('costcontrol:contractPayment:remove')")
    @Log(title = "合同支付跟踪", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gcControlContractPayService.deleteGcControlContractPayByIds(ids));
    }
}
